/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 824202
 */
@Entity
@Table(name = "planes")
@NamedQueries({
    @NamedQuery(name = "Planes.findAll", query = "SELECT p FROM Planes p")})
public class Planes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "nombre")
    private String nombre;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "precio")
    private BigDecimal precio;
    @Size(max = 2)
    @Column(name = "horas")
    private String horas;
    @Size(max = 2)
    @Column(name = "dias")
    private String dias;
    @Size(max = 2)
    @Column(name = "meses")
    private String meses;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "plan")
    private List<Pagos> pagosList;

    public Planes() {
    }

    public Planes(Integer id) {
        this.id = id;
    }
    /**
     * Metodo accesor 
     *
     * @return
     */

    public Planes(Integer id, String nombre, BigDecimal precio) {
        this.id = id;
        this.nombre = nombre;
        this.precio = precio;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public Integer getId() {
        return id;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public void setId(Integer id) {
        this.id = id;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public String getNombre() {
        return nombre;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public void setNombre(String nombre) {
        this.nombre = nombre;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public BigDecimal getPrecio() {
        return precio;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public void setPrecio(BigDecimal precio) {
        this.precio = precio;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public String getHoras() {
        return horas;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public void setHoras(String horas) {
        this.horas = horas;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public String getDias() {
        return dias;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public void setDias(String dias) {
        this.dias = dias;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public String getMeses() {
        return meses;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public void setMeses(String meses) {
        this.meses = meses;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Planes)) {
            return false;
        }
        Planes other = (Planes) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + nombre;
    }

    public List<Pagos> getPagosList() {
        return pagosList;
    }

    public void setPagosList(List<Pagos> pagosList) {
        this.pagosList = pagosList;
    }
    
}
